home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wg_lib / swfrm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  3.7 KB  |  124 lines

  1. VERSION 2.00
  2. Begin Form SWFrm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Swapping"
  5.    ClientHeight    =   3000
  6.    ClientLeft      =   4200
  7.    ClientTop       =   2355
  8.    ClientWidth     =   3795
  9.    Height          =   3405
  10.    Left            =   4140
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3000
  14.    ScaleWidth      =   3795
  15.    Top             =   2010
  16.    Width           =   3915
  17.    Begin CommandButton swCmd 
  18.       Caption         =   "Swap"
  19.       Height          =   375
  20.       Left            =   1425
  21.       TabIndex        =   3
  22.       Top             =   2370
  23.       Width           =   975
  24.    End
  25.    Begin TextBox Sws 
  26.       Height          =   285
  27.       Index           =   2
  28.       Left            =   2025
  29.       TabIndex        =   6
  30.       Text            =   "Second Str$"
  31.       Top             =   1740
  32.       Width           =   1215
  33.    End
  34.    Begin TextBox Sws 
  35.       Height          =   285
  36.       Index           =   1
  37.       Left            =   480
  38.       TabIndex        =   5
  39.       Text            =   "String One"
  40.       Top             =   1740
  41.       Width           =   1215
  42.    End
  43.    Begin TextBox SWV 
  44.       Height          =   285
  45.       Index           =   2
  46.       Left            =   2040
  47.       TabIndex        =   2
  48.       Text            =   "6789"
  49.       Top             =   675
  50.       Width           =   855
  51.    End
  52.    Begin TextBox SWV 
  53.       BackColor       =   &H00FFFFFF&
  54.       Height          =   285
  55.       Index           =   1
  56.       Left            =   825
  57.       TabIndex        =   1
  58.       Text            =   "12345"
  59.       Top             =   675
  60.       Width           =   735
  61.    End
  62.    Begin Label Label2 
  63.       BackColor       =   &H00C0C0C0&
  64.       Caption         =   " Swap Strings"
  65.       Height          =   210
  66.       Left            =   1290
  67.       TabIndex        =   4
  68.       Top             =   1455
  69.       Width           =   1230
  70.    End
  71.    Begin Label Label1 
  72.       BackColor       =   &H00C0C0C0&
  73.       Caption         =   " Swap Values"
  74.       Height          =   210
  75.       Left            =   1260
  76.       TabIndex        =   0
  77.       Top             =   360
  78.       Width           =   1185
  79.    End
  80. DefInt A-Z
  81. Sub Form_Paint ()
  82.      EmbossFrm SWFrm, 465, 375, 1080, 3240, 1
  83.      EmpressFrm SWFrm, 1575, 270, 2175, 3510, 1
  84.      concaveFrm SWFrm, 4
  85.      ConcaveCtl SWV(1), 3
  86.      ConcaveCtl SWV(2), 3
  87.      ConcaveCtl SWS(1), 3
  88.      ConcaveCtl SWS(2), 3
  89. End Sub
  90. Sub swCmd_Click ()
  91.     ' Message sent flag - don't wanna bug user
  92.     MsgSent = 0
  93.     'make sure SwapValue 1 is INT
  94.     a% = Int(Val(LTrim$(RTrim$(SWV(1).text))))
  95.     ' compare to simple value in case there is a decimal
  96.     If a% <> Val(LTrim$(RTrim$(SWV(1).text))) Then
  97.         ' use WIN's MessageBox to note restrictions
  98.         Msg$ = "We are only doing INTEGER Swaps here   '[" + SWV(1).text + "].'"
  99.         MsgBox Msg$, 64, "WGlib"
  100.         
  101.         ' Set flag so second test msg is not redundant
  102.         MsgSent = 1
  103.     End If
  104.     ' same thing for second value
  105.     b% = Int(Val(LTrim$(RTrim$(SWV(2).text))))
  106.     If b% <> Val(LTrim$(RTrim$(SWV(2).text))) Then
  107.         If MsgSent = 0 Then
  108.             Msg$ = "We are only doing INTEGER Swaps here   '[" + SWV(2).text + "].'"
  109.             MsgBox Msg$, 64, "WGlib"
  110.         End If
  111.     End If
  112.     ' swap values, restore to text box control
  113.     SwapI a, b
  114.     SWV(1).text = Format$(a)
  115.     SWV(2).text = Format$(b)
  116.     'assign test to string vars
  117.     i$ = SWS(1).text
  118.     j$ = SWS(2).text
  119.     ' swap and restore to .Text property
  120.     SwapStr i$, j$
  121.     SWS(1).text = i$
  122.     SWS(2).text = j$
  123. End Sub
  124.